FROM openjdk:8u342-slim

LABEL user="chris" mail="majewing@126.com" name="supreme-secret-server" group="supreme-server"

EXPOSE 7250

RUN echo "START BUILD IMAGE"

ARG APP_HOME=/home/supreme-secret-server
RUN mkdir -p ${APP_HOME}/conf
RUN mkdir -p ${APP_HOME}/data
RUN mkdir -p ${APP_HOME}/logs

ARG INPUT_DATE=current-date
RUN echo ${INPUT_DATE} > /home/build-date.log

VOLUME ["${APP_HOME}/conf", "${APP_HOME}/data", "${APP_HOME}/logs"]

ARG JAR_FILE=supreme-secret-server-0.0.1.jar

ADD ${JAR_FILE} ${APP_HOME}/app-server.jar
ADD ./src/main/resources/application.properties ${APP_HOME}/conf/application.properties
ADD ./src/main/resources/application-docker.properties ${APP_HOME}/conf/application-docker.properties
ADD src/main/resources/application-secret-config.properties ${APP_HOME}/conf/application-secret-config.properties

ENV SECRET_USERNAME=supremo
ENV SECRET_PASSWORD=11111111

WORKDIR /home

ENTRYPOINT ["java", "-jar", "app-server.jar", "--spring.profiles.active=docker", "--spring.config.location=./conf/"]
CMD ["--logging.file.name=./logs/supreme-secret-server.log", "--secret-server.secretCommand=dockerfile-command"]
